package com.peteralbus.task;


import com.peteralbus.util.EarthquakeDataUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.io.IOException;
import java.net.URISyntaxException;

/**
 * The type Schedule Task.
 * @author PeterAlbus
 * Created on 2022/1/20.
 */
@Component
public class ScheduleTask
{
    EarthquakeDataUtil earthquakeDataUtil;
    @Autowired
    public void setEarthquakeDataUtil(EarthquakeDataUtil earthquakeDataUtil) {
        this.earthquakeDataUtil = earthquakeDataUtil;
    }

    @Scheduled(cron = "0 0 2 * * ?")
    public void task() throws URISyntaxException, IOException {
        earthquakeDataUtil.get_data();
    }
}
